//
//  YXBottomView.swift
//  yanXiangWeiBo
//
//  Created by 颜祥 on 15/12/24.
//  Copyright © 2015年 yanxiang. All rights reserved.
//

import UIKit
import FFAutoLayout


class YXBottomView: UIView
{
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        // 设置背景色
        backgroundColor = UIColor(white: 0.9, alpha: 1)
        
        // 准备UI
        prepareUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    private func prepareUI()
    {
        // 添加子控件
        addSubview(forwardButton)
        addSubview(commentButton)
        addSubview(zanButton)
        addSubview(separatorFirstView)
        addSubview(separatorSecondView)
        
        // 添加约束
        // 将三个按钮平铺父控件
        self.ff_HorizontalTile([forwardButton,commentButton,zanButton], insets: UIEdgeInsetsZero)
        
        // 分割线1
        separatorFirstView.ff_AlignHorizontal(ff_AlignType.CenterRight, referView: forwardButton, size: nil)
        
        // 分割线2
        separatorSecondView.ff_AlignHorizontal(ff_AlignType.CenterRight, referView: commentButton, size: nil)
    }
    
    // MARK: - 懒加载子控件
    // 转发
    private lazy var forwardButton: UIButton = UIButton(imageName: "timeline_icon_retweet", fontSize: 11, title: "转发")
    
    
    // 评论
     private lazy var commentButton: UIButton = UIButton(imageName: "timeline_icon_comment", fontSize: 11, title: "评论")
    
    // 赞
     private lazy var zanButton: UIButton = UIButton(imageName: "timeline_icon_unlike", fontSize: 11, title: "赞")
    
    // 分割线1
    private lazy var separatorFirstView: UIImageView = UIImageView(image: UIImage(named: "timeline_card_middle_background_highlighted"))
    
    // 分割线2
    private lazy var separatorSecondView: UIImageView = UIImageView(image: UIImage(named: "timeline_card_middle_background_highlighted"))
    
    
    
}
